package com.hrbxlh.virtualization.converter;

import com.hrbxlh.virtualization.param.ClusterUpdateParam;
import com.hrbxlh.virtualization.pojo.Cluster;
import org.springframework.beans.BeanUtils;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

/**
 * @author cheer
 */
@Component
public class ClusterUpdateParamToClusterConverter implements Converter<ClusterUpdateParam, Cluster> {

    @Override
    public Cluster convert(ClusterUpdateParam clusterUpdateParam) {
        Cluster cluster = new Cluster();
        BeanUtils.copyProperties(clusterUpdateParam, cluster);
        cluster.setClusterName(clusterUpdateParam.getName());
        return cluster;
    }
}
